<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="|#{customer.systemTitle}-图灵谷-内容管理-留言管理|">图灵谷</title>
<div th:replace="fragments/head_admin">head</div>
<!--/***** 当前页css  start *****/-->
<!--/***** 当前页css  end *****/-->
</head>
<body>
	<div class="layui-layout layui-layout-admin">
		<div th:replace="fragments/nav_admin">导航栏</div>
		<div th:replace="fragments/menu_admin::menu(parent=content,child=guestbook)">菜单栏</div>
		<!--/*******内容*******/-->
		<div class="layui-body">
			<div class="layui-main">
				<!--/***** 面包屑 *****/-->
				<div class="layui-elem-quote" style="margin-top: 10px;">
					<span class="layui-breadcrumb"> <a><cite>内容管理</cite></a><a th:href="@{/admin/m/ext/guestbook/list.gsp}">留言管理</a><a><cite>列表</cite></a>
					</span>
				</div>
				<!--/*******操作*******/-->
				<form th:action="@{/admin/m/ext/guestbook/list.gsp}" id="typeForm" method="get" class="layui-form">
					<div class="layui-form-item">
						<blockquote class="layui-elem-quote layui-quote-nm">
							<div class="layui-inline">
								<div class="layui-input-inline" style="width: 200px;">
									<select id="typeId" name="typeId" class="layui-select">
										<option value="">留言类型</option>
										<option th:each="guestbookType : ${guestbookType}" th:value="${guestbookType.id}" th:text="${guestbookType.typeName}"></option>
									</select>
								</div>
							</div>
						</blockquote>
					</div>
				</form>
				<!--/***** 列表 *****/-->
				<table class="layui-table" lay-even="" lay-skin="row">
					<thead id="dataTable">
						<tr>
							<th style="width: 40px">#</th>
							<th>状态</th>
							<th>所属类型</th>
							<th>留言标题</th>
							<th>留言内容</th>
							<th>留言日期</th>
							<th>是否回复</th>
							<th>是否推荐</th>
							<th style="width: 140px">操作</th>
						</tr>
					</thead>
					<tbody>
						<tr th:if="${guestbookList.records == null or guestbookList.records.size() == 0}">
							<td colspan="9" style="text-align: center;">暂时没有数据</td>
						</tr>
						<tr th:each="item,items:${guestbookList.records}">
							<td th:text="${guestbookList.pageSize*(guestbookList.page-1)+items.index+1}" style="text-align: center;">序号</td>
							<td th:text="${item.state==1?'已审核':(item.state==2?'屏蔽':(item.state==10?'待审核':''))}">状态</td>
							<td th:text="${item.typeName}">所属类型</td>
							<td th:text="${item.title}">留言标题</td>
							<td th:text="${item.gbContent}">留言内容</td>
							<td th:text="${item.gbDate!=null?#dates.format(item.gbDate,'yyyy-MM-dd HH:mm:ss'):''}">留言日期</td>
							<td th:text="${item.replyed==1?'是':'否'}">是否回复</td>
							<td th:text="${item.recommend==1?'是':'否'}">是否推荐</td>
							<td style="text-align: center;"><a class="layui-btn layui-btn-small" th:href="@{/admin/m/ext/guestbook/edit_{id}.gsp(id=${item.id})}"><i class="layui-icon">&#xe642;</i></a>
								<button class="layui-btn layui-btn-small layui-btn-normal" th:onclick="|deleted('${item.id}')|">
									<i class="layui-icon">&#xe640;</i>
								</button></td>
						</tr>
					</tbody>
				</table>
				<div id="pageDiv"></div>
			</div>
		</div>
		<div th:replace="fragments/footer_admin">底部版权信息等</div>
	</div>
</body>
<div th:replace="fragments/import_js_admin">引入js</div>
<!--/***** 当前页js start *****/-->
<script th:inline="javascript">
    /*<![CDATA[*/
    var $ = layui.jquery;
    var result = /*[[${guestbookList}]]*/;
    $(function(){
        $("#typeId").val(GetQueryString("typeId"));
        var option = {
            listUrl : /*[[@{/admin/m/ext/guestbook/list.gsp?}]]*/,
            totalPages : result.totalPages,
            page : result.page,
            param : {
                typeId
            }
        };
        tg_basePage(option);
        
        $("#typeId").change(function() {
            $("#typeForm").submit();
        });
    })

    var deleteUrl = /*[[@{/admin/m/ext/guestbook/delete_{id}.gsp}]]*/;
    function deleted(id) {
        tg_deleteItem(deleteUrl.replace('{id}',id), function(){
            location.reload();
        });
    }
    /*]]>*/
</script>
<!--/***** 当前页js end *****/-->
</html>